package Finance::NSCC::Insurance::Schema::Transaction;

use strict;
use warnings;

use base 'DBIx::Class';

__PACKAGE__->load_components("Core");
__PACKAGE__->table("transactions");
__PACKAGE__->add_columns(
  "id",
  { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 },
  "nscc_num",
  { data_type => "CHAR", default_value => "", is_nullable => 0, size => 4 },
  "contract_num",
  { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 30 },
  "nscc_control_num",
  { data_type => "CHAR", default_value => "", is_nullable => 0, size => 20 },
  "effective_d",
  { data_type => "DATE", default_value => "", is_nullable => 0, size => 10 },
  "process_d",
  { data_type => "DATE", default_value => undef, is_nullable => 1, size => 10 },
  "dist_trans_id",
  {
    data_type => "VARCHAR",
    default_value => undef,
    is_nullable => 1,
    size => 30,
  },
  "total_amt",
  { data_type => "DECIMAL", default_value => "", is_nullable => 0, size => 16 },
  "source_i",
  { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 1 },
  "identifier",
  { data_type => "VARCHAR", default_value => "", is_nullable => 0, size => 3 },
  "payment_method",
  { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 3 },
  "tax_year",
  { data_type => "YEAR", default_value => undef, is_nullable => 1, size => 4 },
  "charge_1",
  {
    data_type => "DECIMAL",
    default_value => undef,
    is_nullable => 1,
    size => 16,
  },
  "charge_1_q",
  { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 3 },
  "charge_2",
  {
    data_type => "DECIMAL",
    default_value => undef,
    is_nullable => 1,
    size => 16,
  },
  "charge_2_q",
  { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 3 },
  "charge_3",
  {
    data_type => "DECIMAL",
    default_value => undef,
    is_nullable => 1,
    size => 16,
  },
  "charge_3_q",
  { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 3 },
  "charge_4",
  {
    data_type => "DECIMAL",
    default_value => undef,
    is_nullable => 1,
    size => 16,
  },
  "charge_4_q",
  { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 3 },
  "charge_5",
  {
    data_type => "DECIMAL",
    default_value => undef,
    is_nullable => 1,
    size => 16,
  },
  "charge_5_q",
  { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 3 },
  "charge_6",
  {
    data_type => "DECIMAL",
    default_value => undef,
    is_nullable => 1,
    size => 16,
  },
  "charge_6_q",
  { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 3 },
  "charge_7",
  {
    data_type => "DECIMAL",
    default_value => undef,
    is_nullable => 1,
    size => 16,
  },
  "charge_7_q",
  { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 3 },
);
__PACKAGE__->set_primary_key("id");

__PACKAGE__->belongs_to(contract => 'Finance::NSCC::Insurance::Schema::Contract',
                        {
                         'foreign.nscc_num'     => 'self.nscc_num',
                         'foreign.contract_num' => 'self.contract_num',
                        }
                       );

__PACKAGE__->has_many(payee_payors => 'Finance::NSCC::Insurance::Schema::TransPayeePayor',
                      {'foreign.trans_id' => 'self.id'},
                     );

__PACKAGE__->has_many
  (underlying_assets => 'Finance::NSCC::Insurance::Schema::TransUnderlyingAsset',
   {'foreign.trans_id' => 'self.id'},
  );

1;
